/*
 * Copyright@2009 qcj All rights reserved.
 */
package org.firegrid.repository;

import java.util.List;
import java.util.UUID;

import org.firegrid.core.dao.HibernateDao;
import org.firegrid.model.FItem;
import org.firegrid.model.Form;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @author qcj,(jentrees2001@yahoo.com.cn)
 */
@Repository("formRepository")
public class FormRepository {
	@Autowired
	private HibernateDao<Form> hiberanteDao;

	public void save(Form form) {
		form.setFormCode("F_" + UUID.randomUUID());
		this.hiberanteDao.save(form);
	}
	
	public List<FItem> getFItems(Form form){
		return this.hiberanteDao.find("from FItem where form=?", form);
	}
}
